package com.ruoyi.source.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.source.api.domain.SrcLogistics;
import com.ruoyi.source.mapper.SrcLogisticsMapper;
import com.ruoyi.source.service.ISrcLogisticsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 物流记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-23
 */
@Service
public class SrcLogisticsServiceImpl extends ServiceImpl<SrcLogisticsMapper,SrcLogistics> implements ISrcLogisticsService {

    /**
     * 查询物流记录
     *
     * @param logisticsId 物流记录主键
     * @return 物流记录
     */
    @Override
    public SrcLogistics selectSrcLogisticsByLogisticsId(Long logisticsId) {
        return baseMapper.selectSrcLogisticsByLogisticsId(logisticsId);
    }

    /**
     * 查询物流记录列表
     *
     * @param srcLogistics 物流记录
     * @return 物流记录
     */
    @Override
    public List<SrcLogistics> selectSrcLogisticsList(SrcLogistics srcLogistics) {
        System.out.println("aaaaa");
        return baseMapper.selectSrcLogisticsList(srcLogistics);
    }

    /**
     * 新增物流记录
     *
     * @param srcLogistics 物流记录
     * @return 结果
     */
    @Override
    @Transactional
    public int insertSrcLogistics(SrcLogistics srcLogistics) {
        srcLogistics.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertSrcLogistics(srcLogistics);
    }

    /**
     * 修改物流记录
     *
     * @param srcLogistics 物流记录
     * @return 结果
     */
    @Override
    public int updateSrcLogistics(SrcLogistics srcLogistics) {
        srcLogistics.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateSrcLogistics(srcLogistics);
    }

    /**
     * 批量删除物流记录
     *
     * @param logisticsIds 需要删除的物流记录主键
     * @return 结果
     */
    @Override
    public int deleteSrcLogisticsByLogisticsIds(Long[] logisticsIds) {
        return baseMapper.deleteSrcLogisticsByLogisticsIds(logisticsIds);
    }

    /**
     * 删除物流记录信息
     *
     * @param logisticsId 物流记录主键
     * @return 结果
     */
    @Override
    public int deleteSrcLogisticsByLogisticsId(Long logisticsId) {
        return baseMapper.deleteSrcLogisticsByLogisticsId(logisticsId);
    }
}
